<template>
  <el-row>
    <el-col id="aside_top">
      <strong>
        {{title}}
      </strong>
    </el-col>
    <el-col>
      <el-menu
        default-active="2"
        class="el-menu-vertical-demo"
        router
        background-color="#545c64"
        text-color="#fff"
        active-text-color="#ffd04b"  :width="width">
<!--        <Menu :menus="menus"></Menu>-->
        <MenuBar :menus="menus"></MenuBar>
<!--        <el-submenu index="5">-->
<!--          <template slot="title">-->
<!--            <i class="el-icon-location"></i>-->
<!--            <span>快速生成</span>-->
<!--          </template>-->
<!--          <el-menu-item index="/database/table">代码生成</el-menu-item>-->
<!--          <el-submenu index="6">-->
<!--            <template slot="title">-->
<!--              <i class="el-icon-location"></i>-->
<!--              <span>生成配置</span>-->
<!--            </template>-->
<!--            <el-menu-item index="/gen/config/jdbcField">数据库字段配置</el-menu-item>-->
<!--            <el-menu-item index="/gen/config/javaField">Java字段配置</el-menu-item>-->
  <!--            <el-menu-item index="/gen/config/formComponent">表单控件配置</el-menu-item>-->
<!--            <el-menu-item index="/gen/config/formValidate">表单验证配置</el-menu-item>-->
<!--            <el-menu-item index="/gen/config/template">模板配置</el-menu-item>-->
<!--          </el-submenu>-->
<!--        </el-submenu>-->
<!--        <el-submenu index="1">-->
<!--          <template slot="title">-->
<!--            <i class="el-icon-location"></i>-->
<!--            <span>导航栏管理</span>-->
<!--          </template>-->
<!--          <el-menu-item index="/menus/SysMenuTable">菜单列表</el-menu-item>-->
<!--          <el-menu-item index="1-2">选项2</el-menu-item>-->
<!--        </el-submenu>-->
<!--        <el-submenu index="4">-->
<!--          <template slot="title">-->
<!--            <i class="el-icon-location"></i>-->
<!--            <span>常用工具</span>-->
<!--          </template>-->
  <!--          <el-menu-item index="/swagger">接口管理</el-menu-item>-->
<!--        </el-submenu>-->
<!--        <el-submenu index="3">-->
<!--          <template slot="title">-->
<!--            <i class="el-icon-location"></i>-->
<!--            <span>数据库管理</span>-->
<!--          </template>-->
<!--          <el-menu-item index="/database/link">数据库链接列表</el-menu-item>-->
<!--          <el-menu-item index="1-2">选项2</el-menu-item>-->
<!--        </el-submenu>-->
      </el-menu>


    </el-col>
  </el-row>
</template>

<script>
  import {routerOptions} from "../.nuxt/router";
  import SysMenuApi from "@/api/system/SysMenuApi";
  import MenuBar from "./Menu";
  export default {
    name: "Aside",
    components: {MenuBar},
    props:[
      'width'
    ],
    data() {
      return {
        title: "Easy Web 快速开发平台",
        menus:[],
        selectRootId:'8a8a9fc471c91ae60171c91cfb790000',
      }
    },created() {
      this.findAllMenu('8a8a9fc471c91ae60171c91cfb790000');
    },
    methods:{
      findAllMenu(id){
        this.selectRootId = id;
        SysMenuApi.findAllMenuByRoot(id).then(res=>{
          this.menus = res.data;
        })
      }
    }
  }
</script>

<style scoped>
  #aside_top {
    background: #545c64;
    color: white;
    line-height: 60px;
    height: 60px;
    text-align: center;
  }
</style>
